/*import { login, logout, getInfo } from '../../https/api/modules/user'*/
import API from "../../https/api";
import {
  getToken,
  setToken,
  removeToken,
  getLoginName,
  setLoginName,
  removeLoginName,
  setLoginInfo,
  getLoginInfo,
  removeLoginInfo,
  removeMenus,
  removeResorceList,
  setResorceList
} from "@/assets/js/auth";
import { recursion } from "@/assets/js/utils";
import router, { resetRouter } from "@/router";

const getFirstAddr = function(item) {
  item.children = sortMenu(item.children);
  (item.children || []).map(v => {
    v.menuAddr = getFirstAddr(v);
  });
  if (item.menuKind == 3 && item.children) {
    for (let i in item.children) {
      let v = item.children[i];
      if (v.menuKind == 3) {
        let addr = getFirstAddr(v);
        if (addr) {
          return addr;
        }
      } else if (v.menuAddr) {
        return v.menuAddr;
      }
    }
    return "";
  } else {
    return item.menuAddr;
  }
};
const sortMenu = function(arr) {
  return arr
    .map(v => {
      v.children = sortMenu(v.children || []);
      return v;
    })
    .sort((a, b) => {
      return Number(a.menuSort || 999) - Number(b.menuSort || 999);
    });
};

const state = {
  login: false, //登录标记
  token: getToken(), //用户token
  name: getLoginName(), //用户名
  loginInfo: getLoginInfo(), //登录信息
  roles: [], //角色
  unReadCount: "", //未读条数
  avatar: "",
  introduction: "",
  menuList: []
};

const mutations = {
  CHANHE_LOGIN: (state, v) => {
    state.login = v ? v : false;
  },
  SET_TOKEN: (state, token) => {
    state.token = token;
  },
  SET_NAME: (state, name) => {
    state.name = name;
  },
  SET_INFO: (state, loginInfo) => {
    state.loginInfo = loginInfo;
  },
  SET_ROLES: (state, roles) => {
    state.roles = roles;
  },
  SET_UnreadCount: (state, unReadCount) => {
    state.unReadCount = unReadCount;
  },
  SET_AVATAR: (state, avatar) => {
    state.avatar = avatar;
  },
  SET_INTRODUCTION: (state, introduction) => {
    state.introduction = introduction;
  },
  SET_MENUS: (state, menuList) => {
    state.menuList = menuList;
  }
};

const actions = {
  // user login
  login({ commit, dispatch }, userInfo) {
    return new Promise((resolve, reject) => {
      // API.user
      //   .login(userInfo)
      //   .then(response => {
      // const { data } = response;
      const data = "token";
      // console.log(userInfo);
      commit("SET_TOKEN", data);
      setToken(data);
      let name = userInfo.loginname ? userInfo.loginname : "";
      commit("SET_NAME", name);
      setLoginName(name);
      // commit("SET_INFO", JSON.stringify(data.user));
      // setLoginInfo(JSON.stringify(data.user));
      // localStorage.setItem("projectCodes", data.projectCodes);
      // commit("CHANHE_CODES", data.projectCodes);
      commit("CHANHE_LOGIN", true);
      resolve();
      // })
      // .catch(error => {
      //   reject(error);
      // });
    });
  },
  // get user info
  getInfo({ commit, state }) {
    return new Promise((resolve, reject) => {
      API.user
        .getInfo()
        .then(response => {
          const { data } = response;
          /* commit('SET_AVATAR', data.user && data.user.loginName ? data.user.loginName:'')*/
          // if (!data) {
          //   reject('Verification failed, please Login again.')
          // }

          // const { roles, name, avatar, introduction } = data

          // // roles must be a non-empty array
          // if (!roles || roles.length <= 0) {
          //   reject('getInfo: roles must be a non-null array!')
          // }

          // commit('SET_ROLES', roles)
          // commit('SET_NAME', name)
          // commit('SET_AVATAR', avatar)
          // commit('SET_INTRODUCTION', introduction)
          resolve(data);
        })
        .catch(error => {
          reject(error);
        });
    });
  },
  // 获取菜单
  getMenus({ dispatch, commit }) {
    dispatch("getLimit");
    return new Promise((resolve, reject) => {
      // API.user
      //   .menus()
      //   .then(response => {
      // const { data } = response;
      let data = menuList;
      data = sortMenu(data);
      data.map(v => {
        v.menuAddr = getFirstAddr(v);
      });
      commit("SET_MENUS", data);
      resolve(data);
      // })
      // .catch(error => {
      //   reject(error);
      // });
    });
  },
  // 获取权限
  getLimit() {
    return new Promise((resolve, reject) => {
      // API.user
      //   .authority()
      //   .then(response => {
      // const { data } = response;
      const data = recursion({ children: menuList }, "menuCode").filter(v => v);
      setResorceList(data);
      resolve(data);
      // })
      // .catch(error => {
      //   reject(error);
      // });
    });
  },
  getCount({ commit }) {
    //获取消息未读数量
    return new Promise((resolve, reject) => {
      API.books
        .unreadCount()
        .then(response => {
          //const { data } = response
          commit("SET_UnreadCount", response.data ? response.data : 0);
          resolve(response);
        })
        .catch(error => {
          reject(error);
        });
    });
  },
  // user logout
  logout({ commit, state, dispatch }) {
    return new Promise((resolve, reject) => {
      state.token
        ? API.user
            .logout()
            .then(() => {
              resolve();
            })
            .catch(error => {
              reject(error);
            })
        : null;
      commit("SET_TOKEN", "");
      commit("SET_ROLES", []);
      commit("SET_NAME", "");
      removeToken();
      removeLoginName();
      removeLoginInfo();
      removeMenus();
      removeResorceList();
      window.sessionStorage.getItem("loginErr")
        ? window.sessionStorage.removeItem("loginErr")
        : null;
      localStorage.removeItem("projectCodes");
      resetRouter();
    });
  },
  // remove token
  resetToken({ commit }) {
    return new Promise(resolve => {
      commit("SET_TOKEN", "");
      commit("SET_ROLES", []);
      removeToken();
      resolve();
    });
  },

  // dynamically modify permissions
  changeRoles({ commit, dispatch }, role) {
    return new Promise(async resolve => {
      const token = role + "-token";

      commit("SET_TOKEN", token);
      setToken(token);

      const { roles } = await dispatch("getInfo");

      resetRouter();

      // generate accessible routes map based on roles
      const accessRoutes = await dispatch("permission/generateRoutes", roles, {
        root: true
      });

      // dynamically add accessible routes
      router.addRoutes(accessRoutes);

      // reset visited views and cached views

      resolve();
    });
  }
};

export default {
  namespaced: true,
  state,
  mutations,
  actions
};
let menuList = [
  {
    id: "",
    menuName: "工作台",
    menuSort: 1,
    menuAddr: "/workbench",
    menuIcon: "",
    menuKind: 0,
    menuStatus: "1",
    menuCode: "workbench",
    parentId: "0",
    parentName: null,
    children: [
      {
        id: "",
        menuName: "代码生成",
        menuSort: 1,
        menuAddr: "/workbench/codeGeneration",
        menuIcon: "",
        menuKind: 0,
        menuStatus: "1",
        menuCode: "workbench:codeGeneration",
        parentId: "0",
        parentName: null,
        children: []
      },
      {
        id: "",
        menuName: "接口文档",
        menuSort: 1,
        menuAddr: "/workbench/interfaceDocumentation",
        menuIcon: "",
        menuKind: 0,
        menuStatus: "1",
        menuCode: "workbench:interfaceDocumentation",
        parentId: "0",
        parentName: null,
        children: []
      },
      {
        id: "",
        menuName: "新建",
        menuSort: 9,
        menuAddr: "",
        menuIcon: "",
        menuKind: 2,
        menuStatus: "1",
        menuCode: "workbench:add",
        parentId: "0",
        parentName: null,
        children: []
      },
      {
        id: "",
        menuName: "新建",
        menuSort: 9,
        menuAddr: "",
        menuIcon: "",
        menuKind: 2,
        menuStatus: "1",
        menuCode: "workbench:add",
        parentId: "0",
        parentName: null,
        children: []
      },
      {
        id: "",
        menuName: "设置",
        menuSort: 9,
        menuAddr: "",
        menuIcon: "",
        menuKind: 2,
        menuStatus: "1",
        menuCode: "workbench:setUp",
        parentId: "0",
        parentName: null,
        children: []
      },
      {
        id: "",
        menuName: "删除",
        menuSort: 9,
        menuAddr: "",
        menuIcon: "",
        menuKind: 2,
        menuStatus: "1",
        menuCode: "workbench:delete",
        parentId: "0",
        parentName: null,
        children: []
      }
    ]
  },
  {
    id: "",
    menuName: "开发工具",
    menuSort: 1,
    menuAddr: "",
    menuIcon: "",
    menuKind: 3,
    menuStatus: "1",
    menuCode: "tool",
    parentId: "0",
    parentName: null,
    children: [
      {
        id: "",
        menuName: "项目初始化",
        menuSort: 1,
        menuAddr: "/tool/starter",
        menuIcon: "starter",
        menuKind: 0,
        menuStatus: "1",
        menuCode: "tool:starter",
        parentId: "0",
        parentName: null,
        children: []
      },
      {
        id: "",
        menuName: "表单设计",
        menuSort: 1,
        menuAddr: "/tool/formDesign",
        menuIcon: "formDesign",
        menuKind: 0,
        menuStatus: "1",
        menuCode: "tool:formDesign",
        parentId: "0",
        parentName: null,
        children: []
      },
      {
        id: "",
        menuName: "工具箱",
        menuSort: 1,
        menuAddr: "/tool/toolCabinet",
        menuIcon: "toolCabinet",
        menuKind: 0,
        menuStatus: "1",
        menuCode: "tool:toolCabinet",
        parentId: "0",
        parentName: null,
        children: []
      }
    ]
  },
  {
    id: "",
    menuName: "文档中心",
    menuSort: 1,
    menuAddr: "/document",
    menuIcon: "",
    menuKind: 3,
    menuStatus: "1",
    menuCode: "document",
    parentId: "0",
    parentName: null,
    children: [
      {
        id: "",
        menuName: "开发文档",
        menuSort: 1,
        menuAddr: "/document/development",
        menuIcon: "development",
        menuKind: 0,
        menuStatus: "1",
        menuCode: "document:development",
        parentId: "0",
        parentName: null,
        children: []
      },
      {
        id: "",
        menuName: "帮助中心",
        menuSort: 1,
        menuAddr: "/document/helpCenter",
        menuIcon: "helpCenter",
        menuKind: 0,
        menuStatus: "1",
        menuCode: "document:helpCenter",
        parentId: "0",
        parentName: null,
        children: []
      }
    ]
  },
  {
    id: "",
    menuName: "模板中心",
    menuSort: 1,
    menuAddr: "/template",
    menuIcon: "",
    menuKind: 0,
    menuStatus: "1",
    menuCode: "template",
    parentId: "0",
    parentName: null,
    children: []
  },
  {
    id: "",
    menuName: "系统管理",
    menuSort: 1,
    menuAddr: "/system",
    menuIcon: "",
    menuKind: 3,
    menuStatus: "1",
    menuCode: "system",
    parentId: "0",
    parentName: null,
    children: [
      {
        id: "10",
        parentId: "1",
        menuName: "组织机构管理",
        menuSort: "1",
        menuAddr: "/system/organization",
        menuIcon: "organization",
        menuKind: 1,
        menuStatus: 1,
        menuCode: "system:organization",
        creatTime: "2020-07-15 10:28",
        children: [
          {
            id: "131",
            parentId: "13",
            menuName: "添加",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:organization:add",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "132",
            parentId: "13",
            menuName: "修改",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:organization:edit",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "135",
            parentId: "13",
            menuName: "删除",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:organization:delete",
            creatTime: "2020-07-15 10:28"
          }
        ]
      },
      {
        id: "12",
        parentId: "1",
        menuName: "角色管理",
        menuSort: "2",
        menuAddr: "/system/roleManage",
        menuIcon: "roleManage",
        menuKind: 1,
        menuStatus: 1,
        menuCode: "system:roleManage",
        creatTime: "2020-07-15 10:28",
        children: [
          {
            id: "121",
            parentId: "12",
            menuName: "添加",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:add",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "122",
            parentId: "12",
            menuName: "导出",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:export",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "123",
            parentId: "12",
            menuName: "批量启用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:batchStart",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "124",
            parentId: "12",
            menuName: "批量禁用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:batchStop",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "125",
            parentId: "12",
            menuName: "批量删除",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:batchDel",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "126",
            parentId: "12",
            menuName: "修改",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:edit",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "127",
            parentId: "12",
            menuName: "数据权限",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 0,
            menuCode: "system:roleManage:authority",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "128",
            parentId: "12",
            menuName: "分配用户",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:user",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "129",
            parentId: "12",
            menuName: "启用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:start",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "1210",
            parentId: "12",
            menuName: "禁用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:stop",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "1211",
            parentId: "12",
            menuName: "删除",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:roleManage:delete",
            creatTime: "2020-07-15 10:28"
          }
        ]
      },
      {
        id: "11",
        parentId: "1",
        menuName: "用户管理",
        menuSort: "1",
        menuAddr: "/system/userManage",
        menuIcon: "userManage",
        menuKind: 1,
        menuStatus: 1,
        menuCode: "system:userManage",
        creatTime: "2020-07-15 10:28",
        children: [
          {
            id: "111",
            parentId: "11",
            menuName: "添加",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:add",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "112",
            parentId: "11",
            menuName: "模板下载",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:template",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "113",
            parentId: "11",
            menuName: "导入",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:import",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "114",
            parentId: "11",
            menuName: "导出",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:export",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "115",
            parentId: "11",
            menuName: "批量启用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:batchStart",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "116",
            parentId: "11",
            menuName: "批量禁用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:batchStop",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "1162",
            parentId: "11",
            menuName: "批量角色授权",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:role",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "117",
            parentId: "11",
            menuName: "修改",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:edit",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "118",
            parentId: "11",
            menuName: "密码重置",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:resize",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "119",
            parentId: "11",
            menuName: "角色授权",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:user",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "1110",
            parentId: "11",
            menuName: "启用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:start",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "1111",
            parentId: "11",
            menuName: "禁用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:userManage:stop",
            creatTime: "2020-07-15 10:28"
          }
        ]
      },
      {
        id: "13",
        parentId: "1",
        menuName: "菜单管理",
        menuSort: "3",
        menuAddr: "/system/menuManage",
        menuIcon: "menuManage",
        menuKind: 1,
        menuStatus: 1,
        menuCode: "system:menuManage",
        creatTime: "2020-07-15 10:28",
        children: [
          {
            id: "131",
            parentId: "13",
            menuName: "添加",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:menuManage:add",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "132",
            parentId: "13",
            menuName: "修改",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:menuManage:edit",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "133",
            parentId: "13",
            menuName: "启用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:menuManage:start",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "134",
            parentId: "13",
            menuName: "禁用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:menuManage:stop",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "135",
            parentId: "13",
            menuName: "删除",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:menuManage:delete",
            creatTime: "2020-07-15 10:28"
          }
        ]
      },
      {
        id: "14",
        parentId: "1",
        menuName: "字典管理",
        menuSort: "4",
        menuAddr: "/system/dictManage",
        menuIcon: "dictManage",
        menuKind: 1,
        menuStatus: 1,
        menuCode: "system:dictManage",
        creatTime: "2020-07-15 10:28",
        children: [
          {
            id: "141",
            parentId: "14",
            menuName: "添加",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:dictManage:add",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "142",
            parentId: "14",
            menuName: "修改",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:dictManage:edit",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "143",
            parentId: "14",
            menuName: "启用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:dictManage:start",
            creatTime: "2020-07-15 10:28"
          },
          {
            id: "144",
            parentId: "14",
            menuName: "禁用",
            menuSort: "",
            menuAddr: "",
            menuKind: 2,
            menuStatus: 1,
            menuCode: "system:dictManage:stop",
            creatTime: "2020-07-15 10:28"
          }
        ]
      },
      {
        id: "15",
        parentId: "1",
        menuName: "日志管理",
        menuSort: "5",
        menuAddr: "/system",
        menuIcon: "operationLog",
        menuKind: 3,
        menuStatus: 1,
        menuCode: "system:log",
        creatTime: "2020-07-15 10:28",
        children: [
          {
            id: "15",
            parentId: "1",
            menuName: "操作日志管理",
            menuSort: "5",
            menuAddr: "/system/operationLog",
            menuIcon: "operationLog",
            menuKind: 1,
            menuStatus: 1,
            menuCode: "system:operationLog",
            creatTime: "2020-07-15 10:28",
            children: [
              {
                id: "1511",
                parentId: "151",
                menuName: "批量删除",
                menuSort: "",
                menuAddr: "",
                menuKind: 2,
                menuStatus: 1,
                menuCode: "system:operationLog:batchDel",
                creatTime: "2020-07-15 10:28"
              },
              {
                id: "1512",
                parentId: "151",
                menuName: "导出",
                menuSort: "",
                menuAddr: "",
                menuKind: 2,
                menuStatus: 1,
                menuCode: "system:operationLog:export",
                creatTime: "2020-07-15 10:28"
              },
              {
                id: "1513",
                parentId: "151",
                menuName: "删除",
                menuSort: "",
                menuAddr: "",
                menuKind: 2,
                menuStatus: 1,
                menuCode: "system:operationLog:delete",
                creatTime: "2020-07-15 10:28"
              }
            ]
          },
          {
            id: "15",
            parentId: "1",
            menuName: "登录日志管理",
            menuSort: "5",
            menuAddr: "/system/loginLog",
            menuIcon: "loginLog",
            menuKind: 1,
            menuStatus: 1,
            menuCode: "system:loginLog",
            creatTime: "2020-07-15 10:28",
            children: [
              {
                id: "1521",
                parentId: "152",
                menuName: "批量删除",
                menuSort: "",
                menuAddr: "",
                menuKind: 2,
                menuStatus: 1,
                menuCode: "system:loginLog:batchDel",
                creatTime: "2020-07-15 10:28"
              },
              {
                id: "1522",
                parentId: "152",
                menuName: "导出",
                menuSort: "",
                menuAddr: "",
                menuKind: 2,
                menuStatus: 1,
                menuCode: "system:loginLog:export",
                creatTime: "2020-07-15 10:28"
              },
              {
                id: "1523",
                parentId: "152",
                menuName: "删除",
                menuSort: "",
                menuAddr: "",
                menuKind: 2,
                menuStatus: 1,
                menuCode: "system:loginLog:delete",
                creatTime: "2020-07-15 10:28"
              }
            ]
          }
        ]
      }
    ]
  },
  {
    id: "",
    menuName: "初始设置",
    menuSort: 1,
    menuAddr: "/init",
    menuIcon: "",
    menuKind: 3,
    menuStatus: "1",
    menuCode: "init",
    parentId: "0",
    parentName: null,
    children: [
      {
        id: "",
        menuName: "组件管理",
        menuSort: 1,
        menuAddr: "/init/component",
        menuIcon: "component",
        menuKind: 0,
        menuStatus: "1",
        menuCode: "init:component",
        parentId: "0",
        parentName: null,
        children: []
      },
      {
        id: "",
        menuName: "模板管理",
        menuSort: 1,
        menuAddr: "/init/template",
        menuIcon: "template",
        menuKind: 0,
        menuStatus: "1",
        menuCode: "init:template",
        parentId: "0",
        parentName: null,
        children: []
      },
      {
        id: "",
        menuName: "帮助文档管理",
        menuSort: 1,
        menuAddr: "/init/helpDocument",
        menuIcon: "helpDocument",
        menuKind: 0,
        menuStatus: "1",
        menuCode: "init:helpDocument",
        parentId: "0",
        parentName: null,
        children: []
      }
    ]
  }
];
